package com.knowledge.review.designPatterns.behavioralpattern.templateMethodPattern;

public abstract class DayOffProcess {
    // 请假模板
    public final void dayOffProcess() {
        // 领取申请表
        this.pickUpForm();
        // 填写申请信息
        this.writeInfo();
        // 签名
        this.signUp();
        // 提交到不同部门审批
        this.summit();
        // 行政部备案
        this.filing();
    }

    private void filing() {
        System.out.println("行政部备案");
    }

    protected abstract void summit();

    protected abstract void signUp();

    private void writeInfo() {
        System.out.println("填写申请信息");
    }

    private void pickUpForm() {
        System.out.println("领取申请表");
    }
}

class ZhangSan extends DayOffProcess {
    @Override
    protected void summit() {
        System.out.println("张三签名");
    }

    @Override
    protected void signUp() {
        System.out.println("提交到技术部审批");
    }
}

class Lisi extends DayOffProcess {
    @Override
    protected void summit() {
        System.out.println("李四签名");
    }

    @Override
    protected void signUp() {
        System.out.println("提交到市场部审批");
    }
}

class Test {

    // 测试方法
    public static void main(String[] args) {
        DayOffProcess zhangsan = new ZhangSan();
        //领取申请表
        //填写申请信息
        //提交到技术部审批
        //张三签名
        //行政部备案
        zhangsan.dayOffProcess();
        DayOffProcess lisi = new Lisi();
        //领取申请表
        //填写申请信息
        //提交到市场部审批
        //李四签名
        //行政部备案
        lisi.dayOffProcess();
    }
}

